xen/memory: Improve compat XENMEM_acquire_resource handling
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 28 Jul 2020 15:30:12 +0000 (16:30 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Sat, 30 Jan 2021 03:21:33 +0000 (03:21 +0000)
commitb826eaebd852dc229bd7af5826c5c7730606116a
treef4aa53797409fc6ee9ca7c8486543b592d316a42
parent9244528955ded99d0cc341f223a6579362c908bf
xen/memory: Improve compat XENMEM_acquire_resource handling

The frame_list is an input, or an output, depending on whether the calling
domain is translated or not.  The array does not need marshalling in both
directions.

Furthermore, the copy-in loop was very inefficient, copying 4 bytes at at
time.  Rewrite it to copy in all nr_frames at once, and then expand
compat_pfn_t to xen_pfn_t in place.

Re-position the copy-in loop to simplify continuation support in a future
patch, and reduce the scope of certain variables.

No change in guest observed behaviour.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <paul@xen.org>
xen/common/compat/memory.c